{% extends "zato/index.html" %}

{% block html_title %}Pub/sub events{% endblock %}

{% block "extra_css" %}
    <link rel="stylesheet" type="text/css" href="/static/css/jquery.alerts.css">
{% endblock %}

{% block "extra_js" %}

    <script nonce="{{ CSP_NONCE }}" type="text/javascript" src="/static/jquery/jquery.tablesorter.min.js"></script>
    <script nonce="{{ CSP_NONCE }}" type="text/javascript" src="/static/jquery/jquery.cookie.js"></script>
    <script nonce="{{ CSP_NONCE }}" type="text/javascript" src="/static/jquery/jquery.alerts.min.js"></script>

    <script nonce="{{ CSP_NONCE }}" type="text/javascript" src="/static/js/common.js"></script>

    <script nonce="{{ CSP_NONCE }}">
    $.fn.zato.data_table.get_columns = function() {
        return [
            '_numbering',

            '_log_id',
            '_event_id',
            '_name',
            '_timestamp',
            '_ctx',

        ]
    }
    </script>

{% endblock %}

{% block "content" %}
<h2 class="zato">Pub/sub events</h2>

{% if not zato_clusters %}
    {% include "zato/no-clusters.html" %}
{% else %}

    {% if cluster_id %}

        <div id="markup">
            <table id="data-table">
                <thead>
                    <tr class='ignore'>
                        <th style="width:5%">&nbsp;</th>

                        <th><a href="#">Log</a></th>
                        <th><a href="#">Event</a></th>
                        <th><a href="#">Name</a></th>
                        <th><a href="#">Timestamp</a></th>
                        <th><a href="#">Ctx</a></th>

                </thead>

                <tbody>
                {% if items %}
                {% for item in items %}
                    <tr class="{% cycle 'odd' 'even' %}" id='tr_{{ item.id }}'>
                        <td class='numbering'>&nbsp;</td>

                        <td>
                            {{ item.log_id }}
                        </td>

                        <td>
                            {{ item.event_id }}
                        </td>

                        <td>
                            {{ item.name }}
                        </td>

                        <td>
                            {{ item.timestamp }}
                        </td>

                        <td>
                            {{ item.ctx }}
                        </td>

                    </tr>
                {% endfor %}
                {% else %}
                    <tr class='ignore'>
                        <td colspan='5'>No results</td>
                    </tr>
                {% endif %}

                </tbody>
            </table>
        </div>


    {% endif %} {% comment %}cluster_id{% endcomment %}

{% endif %}{% comment %}not zato_clusters{% endcomment %}

{% endblock %}
